﻿var id;
var url;
$(document).ready(function () {
    $("#delete-flaschi-item").click(function () {
        id = -1;
        url = "";
        id = $(this).find(".fid").text();
        url = $(this).find(".furl").text();
        $("#myModal").modal("show");
    });

    $("#delete-flaschi-item-confirmed").click(function () {
        $("#myModal").modal("hide");
        if (id != -1 && url != "") {
            $.ajax({
                url: url,
                type: 'POST',
                success: function (data) {
                    window.location.reload();
                },
                error: function (xhr, textStatus, errThrown) {
                    if (errThrown) alert(errThrown);
                    else alert("Fehler");
                }
            });
        }
        id = -1;
    });
});